package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Operaproject {
    private int operaprojectId;
    private String operaprojectProjiect;
    private Integer operaprojectCost;
    private Collection<Electpres> electpresByOperaprojectId;

    @Id
    @Column(name = "operaproject_id", nullable = false)
    public int getOperaprojectId() {
        return operaprojectId;
    }

    public void setOperaprojectId(int operaprojectId) {
        this.operaprojectId = operaprojectId;
    }

    @Basic
    @Column(name = "operaproject_projiect", nullable = true, length = 50)
    public String getOperaprojectProjiect() {
        return operaprojectProjiect;
    }

    public void setOperaprojectProjiect(String operaprojectProjiect) {
        this.operaprojectProjiect = operaprojectProjiect;
    }

    @Basic
    @Column(name = "operaproject_cost", nullable = true, precision = 0)
    public Integer getOperaprojectCost() {
        return operaprojectCost;
    }

    public void setOperaprojectCost(Integer operaprojectCost) {
        this.operaprojectCost = operaprojectCost;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Operaproject that = (Operaproject) o;
        return operaprojectId == that.operaprojectId &&
                Objects.equals(operaprojectProjiect, that.operaprojectProjiect) &&
                Objects.equals(operaprojectCost, that.operaprojectCost);
    }

    @Override
    public int hashCode() {
        return Objects.hash(operaprojectId, operaprojectProjiect, operaprojectCost);
    }

    @OneToMany(mappedBy = "operaprojectByOperaprojectId")
    public Collection<Electpres> getElectpresByOperaprojectId() {
        return electpresByOperaprojectId;
    }

    public void setElectpresByOperaprojectId(Collection<Electpres> electpresByOperaprojectId) {
        this.electpresByOperaprojectId = electpresByOperaprojectId;
    }


}
